#ifndef _OPTIONAL_H
#define _OPTIONAL_H
#include <Windows.h>

using namespace std;

template <class T>
class Optional {

private:
	bool isSet = false;
	T * value = nullptr;

	Optional(T *pValue) {
		if (pValue != nullptr) {
			isSet = true;
			value = pValue;
		}
	}

public:
	Optional() {}

	static Optional absent() {
		return Optional();
	}

	static Optional of(T *pValue) {
		return Optional(pValue);
	}

	bool exists() { return isSet; }
	T * get() { return value; }

};

#endif
